package com.design.singleton.lazy;

/**
 * @Author: xiemiao
 * @CreateTime: 2023-05-15  16:51
 * @Description: 双重检查锁
 * @Version: 1.0
 */
public class DoubleCheckPattern {

    private volatile static DoubleCheckPattern instance = null;

    private DoubleCheckPattern() {
    }

    public static DoubleCheckPattern getInstance() {
        if (instance == null) {
            synchronized (DoubleCheckPattern.class) {
                if (instance == null) {
                    instance = new DoubleCheckPattern();
                }
            }
        }
        return instance;
    }
}
